package com.aop_xml;

import org.springframework.context.ApplicationContext;
//import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.proxy.Man;

import entity.*;

public class Test {
	public static void main(String[] args) {
		test_pointcut();
		
//		test_interceptor();
	}
	
	public static void test_pointcut(){
		ApplicationContext ctx = new FileSystemXmlApplicationContext(
		 "src/com/aop_xml/aop.xml");
//		ApplicationContext ctx = new ClassPathXmlApplicationContext(
//				"applicationContext.xml");
		 
		CustomerDAO userDAO = (CustomerDAO) ctx.getBean("userDAO");
		
		//Customer cust = (Customer) ctx.getBean("proxycust");
		Customer cust = (Customer) ctx.getBean("cust");
		
		cust.setAccount("SPRING");
		cust.setPassword("SPRING");
		userDAO.save(cust);
	}
	
	public static void test_interceptor(){
		ApplicationContext ctx = new FileSystemXmlApplicationContext(
		 "src/com/aop_xml/fbi.xml");
		
		//Customer cust = new Customer();
		Customer cust = (Customer) ctx.getBean("proxycust");
		//Customer cust = (Customer) ctx.getBean("cust");
		
		cust.setAccount("SPRING");
		cust.setPassword("SPRING");
	}
}
